class Solution {
    bool hash[1010] = { 0 };
public:
    vector<int> intersection(vector<int>& nums1, vector<int>& nums2) {
        vector<int> ret;
        for (auto ch : nums1) {
            hash[ch] = true;
        }
        for (auto e : nums2) {
            if (hash[e]) {
                ret.push_back(e);
                hash[e] = false;
            }
        }
        return ret;
    }
};